package com.mofang.powerdekorhelper.adapter;

import android.content.Context;

import com.mofang.powerdekorhelper.R;
import com.mofang.powerdekorhelper.base.recycleview.BaseRecycleViewAdapter;
import com.mofang.powerdekorhelper.base.recycleview.BaseViewHolder;
import com.mofang.powerdekorhelper.model.Card;
import com.mofang.powerdekorhelper.utils.DateUtils;

import java.util.List;

/**
 * Created by luofei on 2017/8/21 0021.
 */

public class CardAdapter extends BaseRecycleViewAdapter {

    public CardAdapter(List<?> data, Context mContext, int layoutId) {
        super(data, mContext, layoutId);
    }

    @Override
    protected <T> void convert(BaseViewHolder holder, T bean, int position) {

        Card.Data card = (Card.Data) bean;
        holder.setText(R.id.card_coupon_price_tv, card.getCoupons_price() + "");
        holder.setText(R.id.card_coupon_step_tv, "满" + card.getStep_value() + "使用");
        holder.setText(R.id.card_coupon_time_tv, "有效期限：" + DateUtils.getDay(card.getStart_time()) + "-" + DateUtils.getDay(card.getEnd_time()));
        holder.setText(R.id.card_coupon_already_buy_num, "已抢" + card.getSale_count() + "");

        holder.itemView.setTag(card);
    }

}
